import heapq

def frequencySort(s):
    count = {}
    for c in s:
        count[c] = count.get(c, 0) + 1
    items = [(-val, key) for key, val in count.items()]
    heapq.heapify(items)
    res = ""
    while items:
        val, key = heapq.heappop(items)
        res += key * (-val)
    return res

print(frequencySort(input()))